package interfaces;


import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JLabel;
import javax.swing.SwingConstants;



public class mainMenuScreen extends MyPanel implements ActionListener //class to display main menu screen
{
	private MyButton PlayButton;
	private MyButton AboutButton;
	private MyButton ExitButton;
	private MainWindow mainWin;
	public mainMenuScreen(MainWindow win)
	{
		super();
		mainWin=win;
		
		//calculate position of GUI components
		int w=win.getWidth();
		int h=win.getHeight();
		int button_w=w/3;
		int button_h=h/9;
		int space_x=w/3;
		int space_y=0;
		int padd_y=h/3;
		
		//create GUI components and add into specified position
		JLabel titleLabel=new JLabel("");
		titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
		titleLabel.setFont(new Font("Hand of Sean", Font.BOLD, 48));
		titleLabel.setOpaque(false);
		titleLabel.setForeground(Color.green);
		titleLabel.setText("GUESS PEOPLE!");
		titleLabel.setBounds(0,0,w,padd_y);
		this.add(titleLabel);
		PlayButton=new MyButton("Play Game");
       // PlayButton.setBorder(new EmptyBorder(1,1,1,1));
		PlayButton.setBounds(space_x,padd_y,button_w,button_h);
		this.add(PlayButton);
		AboutButton=new MyButton("About Game");
		AboutButton.setBounds(space_x,(button_h+space_y)+padd_y,button_w,button_h);
		this.add(AboutButton);  
		ExitButton=new MyButton("Quit");
		ExitButton.setBounds(space_x,2*(button_h+space_y)+padd_y,button_w,button_h);
		this.add(ExitButton); 
	//	this.paintBackGround("images/screen.png",w ,h);
		PlayButton.addActionListener(this);
		AboutButton.addActionListener(this);
		ExitButton.addActionListener(this);
	}
	@Override
	public void actionPerformed(ActionEvent ae) 
	{
		// TODO Auto-generated method stub
      if(ae.getSource()==PlayButton)
    	   mainWin.changeScreen(new PlayScreen(mainWin));
      if(ae.getSource()==AboutButton)
    	   mainWin.changeScreen(new aboutGame(mainWin));
      if(ae.getSource()==ExitButton)
    	   System.exit(0);
	}
}
